package com.inplaceedit.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiChild;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasOneWidget;
import com.google.gwt.user.client.ui.Widget;

public class ListItemPanel extends Composite {

	interface Binder extends UiBinder<Widget, ListItemPanel> {
	}

	private static Binder uiBinder = GWT.create(Binder.class);

	@UiField
	CommandPanel panel;
	@UiField
	Anchor deleteCommand;

	public ListItemPanel() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	public HasOneWidget getContentPanel() {
		return panel.getContentPanel();
	}

	public HasClickHandlers getDeleteCommand() {
		return deleteCommand;
	}

	@UiChild(limit = 1)
	public void setContentWidget(final Widget w) {
		getContentPanel().setWidget(w);
	}
}
